new step to expand java wildcard imports#2744
Merged
nedtwigg merged 12 commits intodiffplug:mainfrom Jan 21, 2026
Merged
Conversation
db71c5d to
1a293cb
Compare
Member
|
Amazing! This would be a fantastic feature to merge. I don't have time to examine it in detail at the moment, burned by time budget on fixing problems in our CI. Thanks for the great contribution and I'll try to get to this ASAP! Hopefully some other reviewers can take a stab at it... |
Pankraz76
reviewed
Nov 21, 2025
| ``` | ||
| spotless { | ||
| java { | ||
| expandWildcardImports() |
There was a problem hiding this comment.
finally don´t have to rely on rewrite anymore, as its not applying all.
lib/src/javaParser/java/com/diffplug/spotless/glue/javaparser/ExpandWildcardsFormatterFunc.java
Show resolved
Hide resolved
3 tasks
Pankraz76
reviewed
Nov 22, 2025
lib/src/javaParser/java/com/diffplug/spotless/glue/javaparser/ExpandWildcardsFormatterFunc.java
Show resolved
Hide resolved
|
rebase will fix CI, thanks for the feature. Sorry for noisy delay. |
Pankraz76
approved these changes
Dec 3, 2025
Pankraz76
left a comment
There was a problem hiding this comment.
well done seems ready to merge.
polish and might deprecating removeWildcard could be follow up issues.
Appreciate the initiative and contribution.
lib/src/javaParser/java/com/diffplug/spotless/glue/javaparser/ExpandWildcardsFormatterFunc.java
Show resolved
Hide resolved
# Conflicts: # CHANGES.md # plugin-gradle/CHANGES.md
Member
|
Ambitious PR! Sorry it took so long to get merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As requested in #2594, this MR introduces an
expandWildcardImportsstep. To do this, JavaParser is used to parse the complete sourcecode and resolve the full qualified name of all used classes and static methods.The operation is currently only implemented for Gradle, as I am not familiar enough with the maven plugin system to provide the necessary classpath information.